package finalproject.model.rooms;

import java.util.List;

import finalproject.model.player.Player;
import finalproject.model.player.fight.Ability;
import finalproject.view.StringManager;

/**
 * A gym is a room where a player can increase the attack strength of its pet. 
 * However, there is a cost to do this, energy will be deducted from the player and the pet.
 * 
 * @author Shafiq Daniel
 *
 */

public class Gym extends Room{

	private static final int PLAYER_ENERGY_NEEDED = 3;
	private static final int PET_ENERGY_NEEDED = 5;
	
	public Gym(String description, boolean isLighted) {
		super(description, isLighted);
		// TODO Auto-generated constructor stub
	}

	@Override
	public boolean prepareActivity(Player p) {
		return false;		
	}

	private void addStrength(List<Ability> petAbilities) {
		
		for(int i=0;i<petAbilities.size();i++)
			petAbilities.get(i).setStrength(petAbilities.get(i).getStrength() + 1);
		
	}

	@Override
	public boolean doActivity(Player p) {
		int playerEnergy = p.getEnergy().getEnergy();
		int petEnergy = p.getPet().getEnergy().getEnergy();
		
		if(playerEnergy>PLAYER_ENERGY_NEEDED && petEnergy>PET_ENERGY_NEEDED)
		{
			List<Ability> petAbilities = p.getPet().getAbilities();
			addStrength(petAbilities);
			StringManager.outPut("strengthup");
			p.getEnergy().setEnergy(playerEnergy-PLAYER_ENERGY_NEEDED);
			p.getPet().getEnergy().setEnergy(petEnergy-PET_ENERGY_NEEDED);
			return true;
		}
		else{
			StringManager.outPut("lowenergy");
			return false;
		}		
	}
	

}
